package com.example.k8sdemo.controller;

import com.example.k8sdemo.dto.UserDto;
import com.example.k8sdemo.param.AddUserParam;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @Description:
 * @Author: xieguangda
 * @Date: 2021年06月02日 13:46
 */
@Controller
public class UserController {

    @ApiOperation(value = "新增用户")
    @ApiResponses({ @ApiResponse(code = 200, message = "OK", response = UserDto.class) })
    @PostMapping("/user")
    @ResponseBody
    public UserDto addUser(@RequestBody AddUserParam param) {
        System.err.println(param.getName());
        return new UserDto(Integer.parseInt(param.getId()),param.getName());
    }


}
